/**
* 分页器
*TablePagination.js*/
import React, {Component,PropTypes} from 'react';
import {connect} from 'dva';
import {routerRedux,Link,withRouter } from 'dva/router';
import { Pagination } from 'antd';
const pageSizeOptions = ['15', '25', '35', '45'];
export default class TablePagination extends Component {
 
  static propTypes = {
    // page: PropTypes.object.isRequired,
  }

  static defaultProps = {
  }
  //分页
  handleChangePage=(page, pagesize)=> {
    const {tag} = this.props;
    console.log('page>>>>',page,"pagesize>>>>",pagesize)
    if(tag=='benchmarkMgt'){
      this.props.dispatch({
        type: `benchmarkMgt/getBenchmark`,
        payload: {
          'currentpage': page,
          'pagesize':pagesize,
        }
      })
    }
  }
  //条数
  onShowSizeChange=(current, pageSize)=> {
    const {tag} = this.props;
    if(tag=='benchmarkMgt'){
      this.props.dispatch({
        type: `benchmarkMgt/getBenchmark`,
        payload: {
          'currentpage': 1,
          'pagesize':pageSize
        }
      })
    }
    
    
  }
  onQuickJumperChange=(pageNumber)=>{
  	console.log('onShowSizeChange>>>>',pageNumber)
  }
  render() {
    const {page} = this.props;
    console.log('pppppppppp',page)
    return (
      <Pagination
     		showSizeChanger
     		pageSizeOptions={pageSizeOptions}
        total={page.totalnum}
     		current={page.currentpage}
     		pageSize={page.pagesize}
     		onShowSizeChange={this.onShowSizeChange}
     		onChange={this.handleChangePage}
        style={{ marginTop: 10 }}
      />
    );
  }
}